<?php

class betalingen
{
    private $leerlingRepository;
    private $betalingenRepository;
    private $pakketRepository;

    public function __construct($pakketRepository, $leerlingRepository, $betalingenRepository)
    {
        $this->pakketRepository = $pakketRepository;
        $this->leerlingRepository = $leerlingRepository;
        $this->betalingenRepository = $betalingenRepository;
    }
    
    public function HaalAllePakketenOp()
    {
        $pakketen = $this->pakketRepository->AllePakketen();
        echo json_encode($pakketen);
    }
    
    public function Betalingen()
    {
       $_SESSION['rol_id'] = 0;
       $_SESSION['id'] = 4;
       
       if($_SESSION['rol_id'] == 0) // Instructeur
       {
            $leerlingen = $this->leerlingRepository->AlleLeerlingenVan($_SESSION['id']);
       }
       else // Beheerder
       {
            $leerlingen = $this->leerlingRepository->AlleLeerlingen();
       }
       echo json_encode($leerlingen);
    }
    
    public function SpecifiekPersoon($id)
    {
        $leerling = $this->leerlingRepository->Leerling($id);
        echo json_encode($leerling);
    }
    
    public function BetalingenSpecifiekPersoon($id)
    {
        $betalingen = $this->betalingenRepository->BetalingVan($id);
        echo json_encode($betalingen);
    }
}
?>
